<!DOCTYPE html>
<html lang="en">

<include file="CommonSidebar:common-head"/>
<link rel="stylesheet" href="__ROOT__/Application/Admin/Public/css/common.css">
<link href="__ROOT__/Application/Admin/Public/css/jquery.datetimepicker.css" rel="stylesheet">
<body>

<div id="wrapper">

    <!-- Navigation -->
    <include file="CommonSidebar:common-navbar"/>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">所有仓库</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-2">
                <a href="{:U('AddIndex')}"><button class="btn btn-block btn-primary">添加仓库</button></a>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">

                <div class="row">
                    <div class="col-md-12">
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                    <tr>
                                        <th style="text-align: center">仓库编号</th>
                                        <th style="text-align: center">仓库名称</th>
                                        <th  style="text-align: center">省</th>
                                        <th  style="text-align: center">市</th>
                                        <th  style="text-align: center">区/县</th>
                                        <th  style="text-align: center">详细地址</th>
                                        <th style="text-align:center" width="80px">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <foreach name="DATA" item="v" key="k">
                                        <tr class="odd gradeX" id="tr{$v.unid}">
                                            <td>{$v.BHCODE}</td>
                                            <td>{$v.NAME}</td>
                                            <td>{$v.P}</td>
                                            <td>{$v.C}</td>
                                            <td>{$v.Z}</td>
                                            <td>{$v.ADDRESS}</td>
                                            <td class="center" style="text-align:center">
                                                <a  class="btn btn-block btn-primary" href="{:U('SJindex')}?BHCODE={$v.BHCODE}">查看仓库中的书架</a>
                                                <a class="btn btn-block btn-primary"
                                                   href="{:U('AddIndex')}?ID={$v.ID}">编辑</a>
                                                <a class="btn btn-block btn-primary" onclick="del({$v.ID},$(this))"
                                                    title="Delete">删除</a>
                                            </td>
                                        </tr>
                                    </foreach>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                        </div>

                    </div>
                </div>


            </div>
        </div>

    </div>
</div>

<include file="CommonSidebar:common-script"/>
<script src="__ROOT__/Application/Admin/Public/js/jquery.datetimepicker.js"></script>
<!-- DataTables JavaScript -->
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<!-- Page-Level Demo Scripts - Tables - Use for reference -->


<script type="text/javascript" src="__ROOT__/Application/Admin/Public/LoadPading/LoadPading.js?v=3"></script>
<link rel="stylesheet" href="__ROOT__/Application/Admin/Public/LoadPading/LoadPading.css" type="text/css"
      media="screen"/>


<script>
    $(document).ready(function () {
        $('#dataTables-example').DataTable({
            responsive: true
        });
    });
</script>

<script>
    function del(ID,$elem) {
        if (confirm("确认删除？")) {
            $.post("{:U('DelCK')}",
                    {ID: ID},
                    function (data) {
                        if (parseInt(data) == 1) {
                            $elem.parent().parent().remove();
                            alert( '删除成功');
                        } else {
                            alert('删除失败');
                        }
                    });
        }
    }
</script>
</body>

</html>
